package com.salt.modules.log.web;

import com.salt.common.json.AjaxJson;
import com.salt.modules.log.model.query.RecordQuery;
import com.salt.modules.log.service.LogService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description
 * @Author salt
 * @Date 2023/5/22
 * @Version 1.0.1
 */
@RestController
@RequestMapping("log/record")
public class LogController {

    @Resource
    private LogService logService;

    @PostMapping("operation")
    public AjaxJson operationRecordPage(@RequestParam("pageNum") Integer pageNum,
                                        @RequestParam("pageSize") Integer pageSize,
                                        RecordQuery recordQuery) {
        Map<String, Object> page = logService.operationRecordPage(pageNum, pageSize, recordQuery);
        return AjaxJson.success().putMap(page);
    }

    @PostMapping("login")
    public AjaxJson loginRecordPage(@RequestParam("pageNum") Integer pageNum,
                                        @RequestParam("pageSize") Integer pageSize,
                                        RecordQuery recordQuery) {
        Map<String, Object> page = logService.loginRecordPage(pageNum, pageSize, recordQuery);
        return AjaxJson.success().putMap(page);
    }
}
